import Child from './Child';
import { useEffect, useRef, useState } from 'react';

export default function Parent() {
  const childRef = useRef(null);
  const [v, setV] = useState(0);
  console.log('--render parent', childRef.current);
  return (
    <div>
      this is Parent <button onClick={() => setV((p) => p + 1)}>+1</button>
      {v}
      <Child
        ref={(d) => {
          childRef.current = d;
          //   console.log('child change', d);
        }}
      ></Child>
    </div>
  );
}
